package com.wulinbus.utils;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.jasig.cas.client.authentication.AttributePrincipal;

import com.fancy.common.utils.StringUtil;

public class CasUtil {
	
	public static String getUid(HttpServletRequest request){
		String uid = "";
		AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
		if (principal != null) {
			Map attributes = principal.getAttributes();
			String uidTemp = (String) attributes.get("uid");
			if (!StringUtil.isEmpty(uidTemp)) {
				uid = uidTemp;
			}
		}
		return uid;
	}
}